﻿' ----------------------------------------------------------------------
'
' DbfsConnection.vb
'
'   Dbfs
'
'   Provides the ability to control 
'
' ----------------------------------------------------------------------
' version:  1.0.0.1
' today:    03/04/10  08:38:00
' ident:    "@(#)/Dbfs/Connection.vb 1.0 0.1 03/04/10 0 rjs"

Imports System.Data.Common

Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Configuration
Imports System.Security.Principal

Imports System.Security.AccessControl
Imports System.ComponentModel

Imports Dbfs.Configuration
Imports Dbfs.Data


Namespace Dbfs

    Public NotInheritable Class DbfsConnection

        ''' <summary>
        ''' The data context for any filesystem object.
        ''' </summary>
        ''' <remarks></remarks>
        Private _context As IDataContext


#Region " Constructors "
        Public Sub New(ByVal fileSystemName As String)
            ' get the data context for this filesystem
            Dim providerFactory As IDataProviderFactory = New DataAccessProviderFactory(fileSystemName)
            _context = providerFactory.GetDataContext(fileSystemName)
        End Sub
#End Region

#Region " Properties "
        ''' <summary>
        ''' Gets a boolean value indicating if cascade deletes are enabled in the database.
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks>Cascade deletes minimize recursive programming to delete child objects.</remarks>
        Friend ReadOnly Property CascadeDeletes() As Boolean
            Get
            End Get
        End Property

        Public ReadOnly Property Context() As IDataContext
            Get
                Return _context
            End Get
        End Property

        Public ReadOnly Property FileSystemName() As String
            Get
                Return _context.FileSystemName
            End Get
        End Property

        ''' <summary>
        ''' Indicates the state of the <see cref="DbfsConnection"/>.
        ''' </summary>
        ''' <value>An <see cref="ConnectionState"/> enumeration.</value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property State() As System.Data.ConnectionState
            Get
                Return ConnectionState.Closed
            End Get
        End Property
#End Region ' Properties

    End Class

End Namespace